﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UMLTouch.Core.Entities;
using System.Windows;

namespace UMLTouch.Core.UI
{
    public enum ItemAnchorDirection
    {
        Top,
        Bottom,
        Left,
        Right,
        Single
    }

    public class ItemAnchor
    {
        //IDiagramItem _sourceItem;
        List<ItemAnchor> _connectedAnchors;
        IAnchorable _sourceControl;
        Point _position;

        public event EventHandler AnchorMoved;

        public IAnchorable Source
        {
            get { return _sourceControl; }
        }

        public ItemAnchorDirection Direction { get; protected set; }

        public Point Position 
        {
            get
            {
                return _position;
            }
            set 
            {
                if (_position != value)
                {
                    _position = value;

                    if(AnchorMoved != null)
                        AnchorMoved(this, null);
                }
            }
        }


        public List<ItemAnchor> ConnectedAnchors    
        {
            get { return _connectedAnchors; }
        }

        public ItemAnchor(IAnchorable source, ItemAnchorDirection direction, Point position)
        {
            _sourceControl = source;
            Direction = direction;
            _connectedAnchors = new List<ItemAnchor>();
            Position = position;

        }


        


        
    }

  
}
